<!DOCTYPE html>
{% comment %} {% load cache %} {% endcomment %}
{% load i18n %}
<html lang="ru">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <title>
      {% block title %}

      {% endblock %}
    </title>
    {% load static %}
    <link href="{% static 'css/styles.css' %}" rel="stylesheet" />
  </head>
  {% comment %} {% cache 30 navbar %} {% endcomment %}
  <div>
    <!-- Responsive navbar -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
      <div class="container">
        <a class="navbar-brand" href="/news/">{% trans "Газета" noop%}</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
        <div class="collapse navbar-collapse" id="navbarResponsive">
          <ul class="navbar-nav ml-auto">
            <li class="nav-item active">
              {# <a class="nav-link" href="/news/">Домой #}
              {# <span class="sr-only">(current)</span> #}
              {# </a> #}
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/news/create/">{% trans "Добавить новость" noop %}</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/articles/create/">{% trans "Добавить статью" noop %}</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="/news/search/">{% trans "Поиск" noop %}</a>
            </li>
          </ul>
        </div>
        <a class="navbar-brand" href="/news/profile/">{% trans "Профиль" noop %}</a>
      {% comment %} {% endcache %} {% endcomment %}
        <form action="{% url 'set_language' %}" method="POST"> {% csrf_token %} <!-- Не забываем по csrf_token для POST запросов -->
        <input type="hidden" name="next" value="{{ redirect_to }}">
        <select name="language" id="">
            {% get_available_languages as LANGUAGES %} <!-- получаем языки -->
            {% get_language_info_list for LANGUAGES as languages %} <!-- Помещаем их в список languages -->
            {% for language in languages %} <!-- Итерируясь по списку, выводим их название на языке пользователя и код -->
                <option value="{{ language.code }}" {% if language.code == LANGUAGE_CODE %} selected {% endif %}>
                    {{ language.name_local }} - {{ language.code }}
                </option>
            {% endfor %}
        </select>
        <input type="submit" value={% trans "Изменить" noop %}>
    </form>
      </div>
    </nav>
    <!-- Page content -->
    <div class="container">
      <div class="row">
        <div class="col-lg-12 text-center">
          {% block content %}

          {% endblock %}
        </div>
      </div>
    </div>
  </div>
</html>
